package com.buba.service.impl;


import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.buba.mapper.DiaryMapper;
import com.buba.service.DiaryService;
import entity.DiaryEntity;
import common.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import result.CommonResult;

import java.util.Date;
import java.util.List;

@Service
public class DiaryServiceImpl extends ServiceImpl<DiaryMapper, DiaryEntity> implements DiaryService {

    @Autowired
    DiaryMapper diaryMapper;


    @Override
    public Result diary(String id) {
        return diaryMapper.diary(id);
    }

    @Override
    public List<DiaryEntity> diaryList() {
        return diaryMapper.diaryList();
    }

    @Override
    public Result selectTime() {
        // 获取当前时间字符串，yyyy-MM-dd HH:mm:ss
        /* String date = DateUtil.now()*/

   /*     Date date = new Date();
        date.getTime();*/

        //当前日期字符串，格式：yyyy-MM-dd
        String today= DateUtil.today();
        System.out.println(today);

        return Result.success(today);
    }


}
